Skip to content

feat(agents): per-agent environment variables - #4011

Open
wpfleger96 wants to merge 15 commits into
mainfrom
duncan/per-agent-env
Open

wpfleger96 wants to merge 15 commits into
mainfrom
duncan/per-agent-env

Conversation

@wpfleger96

@wpfleger96 wpfleger96 commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Stack: this is the base; #3899 (device-wide environment variables) stacks on it.

What this does

Adds Environment variables to each local agent's Settings → Agent details: a list of variables that agent starts with, on Claude Code, Codex, Goose and Pi agents.

  • Storage: device-local, in the OS credential store (buzz_credential_store: Keychain, Secret Service, Credential Manager), one item per agent under xyz.block.buzz.desktop.agent-env.agent with the agent's pubkey as the account. Never synced. No command returns a value; Settings gets names only. The list is the same for an agent in every community on this device.
  • Who gets it: only a process that asks for it with the agent-env entry in the secrets option, names the agent with envAgent, and runs a local, unprotected agent. Native code in plugin_host_process_spawn checks the agent is a live, unprotected agent here and the plugin and process allowlist (claude-sh, codex-sh, goose, pi-sh/node), and refuses a protected launch. Setup steps, protected and hosted agents and other plugins never get it. The editor shows only for local agents on the four bundled harnesses that aren't protected.
  • Shared processes: Claude and Goose already run a process per agent. Codex and Pi start an agent that has its own list in a process of its own; other agents keep sharing one. Which process an agent uses is chosen when its process starts, from whether its list has any names; a save never moves a running agent. If that can't be read, the agent starts on the shared process and it is read again at the next start. Claude's spare process is used only by an agent known to have no list.
  • Precedence: applied in set_environment right after the login-shell variables, then run through the BUZZ_*/NOSTR_* strip, then PATH and the harness's own env, so a harness's variable wins. The one exception is a saved ANTHROPIC_API_KEY: it is applied again after the harness's env (which clears an inherited key for Claude Code), takes the place of the shared saved key, and counts as a credential for a signed-out launch. An inherited key is still removed and doesn't count.
  • Store unreadable at spawn: the agent starts without the list; the failure is logged without values.
  • Validation at save: names [A-Za-z_][A-Za-z0-9_]* (≤128), compared ignoring case, duplicates differing only in case rejected; no NUL in values; the serialized list must fit 2560 UTF-16 bytes (the Windows Credential Manager limit, applied everywhere). A failed save changes nothing. A save is refused for an agent that is being removed or can't have a list.
  • Editing: each row is keep (saved value, left blank) or set; a saved name left out is deleted. The editor is locked while a save or Restart agent runs, so no edit can land after a restart has started the agent's processes, Save keeps keyboard focus, leaving the agent with unsaved edits asks first, and the agent's tabs and leaving it wait while a save or restart runs, so a failed restart's error stays on screen, like the agent's other settings. If the list can't be read, Settings shows the error and Retry, never an empty list.
  • When it applies: to agent processes started after the save. Running agents keep the list they started with. Restart agent (below) applies a saved list without restarting Buzz.
  • Cleanup: removing an agent from its last community on this device deletes its list first; if that fails the agent stays and Remove can be retried. Sign out deletes the lists of the agents it removes.

Blocked names

Reserved: PATH, BUZZ_*, NOSTR_*.

Harness file locations, which Buzz and the harnesses use to find installs, settings and conversation history: HOME, CLAUDE_CONFIG_DIR, CODEX_HOME, GOOSE_PATH_ROOT, XDG_CONFIG_HOME, PI_CODING_AGENT_DIR, USERPROFILE, XDG_DATA_HOME, LOCALAPPDATA.

Claude Code (official env-var reference, code.claude.com/docs/en/env-vars, and claude.ts provider selectors):
ANTHROPIC_MODEL, ANTHROPIC_DEFAULT_MODEL, ANTHROPIC_DEFAULT_{OPUS,SONNET,HAIKU,FABLE}_MODEL, ANTHROPIC_SMALL_FAST_MODEL, ANTHROPIC_CUSTOM_MODEL_OPTION, CLAUDE_CODE_SUBAGENT_MODEL, CLAUDE_CODE_SUBAGENT_MODEL_FORCE, CLAUDE_CODE_AUTO_MODE_MODEL, CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST, CLAUDE_CODE_USE_{BEDROCK,VERTEX,FOUNDRY,GATEWAY,MANTLE,ANTHROPIC_AWS,ANTHROPIC_GOOGLE_CLOUD}; endpoints ANTHROPIC_BASE_URL, ANTHROPIC_{AWS,BEDROCK,BEDROCK_MANTLE,FOUNDRY,GOOGLE_CLOUD,VERTEX}_BASE_URL, ANTHROPIC_UNIX_SOCKET, CLAUDE_CODE_API_BASE_URL, and ANTHROPIC_FOUNDRY_RESOURCE.

Goose 1.60.1 (b4e789ef, the version in runtime/goose-acp.json; config keys are also read from their upper-case env names):
GOOSE_PROVIDER, GOOSE_MODEL, ACTIVE_PROVIDER, PROVIDERS, PROVIDER, GOOSE_PROVIDER__TYPE, GOOSE_SUBAGENT_{PROVIDER,MODEL}, GOOSE_TOOLSHIM_{MODEL,OLLAMA_MODEL,BACKEND}, LOCAL_LLM_MODEL, GOOSE_LOCAL_DRAFT_MODEL, GOOSE_LIVE_VOICE_MODEL, AZURE_FOUNDRY_MODEL, AZURE_OPENAI_DEPLOYMENT_NAME, SAGEMAKER_ENDPOINT_NAME, DATABRICKS_MODEL_FILTER; endpoints GOOSE_PROVIDER__HOST, GOOSE_LIVE_VOICE_ENDPOINT, OPENAI_HOST, OPENAI_BASE_URL, AZURE_OPENAI_ENDPOINT, AZURE_FOUNDRY_ENDPOINT, DATABRICKS_HOST, ANTHROPIC_HOST, GOOGLE_HOST, OLLAMA_HOST, OPENROUTER_HOST, XAI_HOST, GROQ_HOST, LITELLM_HOST, SNOWFLAKE_HOST, GITHUB_COPILOT_HOST, GITHUB_COPILOT_TOKEN_URL, TETRATE_HOST, AVIAN_HOST, GONDOLA_HOST, MUSE_CODE_HOST, MUSE_CODE_AUTH_HOST, ATOMIC_CHAT_HOST, LEMONADE_HOST, LLAMA_SWAP_HOST, LMSTUDIO_HOST, HF_HOST, LYNKR_HOST, OMLX_HOST, ROUTSTR_HOST, PRIVATEMODE_ENDPOINT, TANZU_AI_ENDPOINT, NEON_AI_GATEWAY_BASE_URL, MOONSHOT_BASE_URL, ZAI_BASE_URL, ZHIPU_BASE_URL, ASTRON_BASE_URL, OPENAI_BASE_PATH, LITELLM_BASE_PATH.

Codex 0.169.1 (source at c376cf73, every env::var read swept): no model or provider variables (model comes from config/-m). Endpoints: OPENAI_BASE_URL, CODEX_OSS_BASE_URL, CODEX_OSS_PORT, CODEX_APP_SERVER_CHATGPT_BASE_URL, CODEX_AUTHAPI_BASE_URL, CODEX_{REFRESH,REVOKE}_TOKEN_URL_OVERRIDE, CODEX_EXEC_SERVER_URL, CODEX_CLOUD_TASKS_BASE_URL, CODEX_AGENT_IDENTITY_AUTHAPI_BASE_URL, CODEX_AGENT_IDENTITY_JWKS_BASE_URL, CODEX_APP_SERVER_LOGIN_ISSUER; AWS SDK endpoint overrides AWS_ENDPOINT_URL, AWS_ENDPOINT_URL_BEDROCK_RUNTIME, AWS_ENDPOINT_URL_STS.

AWS credential sources (where credentials are fetched from): AWS_CONTAINER_CREDENTIALS_FULL_URI (pi-ai 1.5.0 providers/amazon-bedrock.js:77-82, env-api-keys.js:150-156; aws-config 1.8.12 ecs.rs:82, used by Codex aws-auth), AWS_EC2_METADATA_SERVICE_ENDPOINT (aws-config 1.8.12 imds/client.rs:513). AWS_CONTAINER_CREDENTIALS_RELATIVE_URI stays allowed: it is only a path on the fixed link-local host.

Pi (@earendil-works/pi-ai, chord, pi-codemode, pi-durable, pi-schema, pi-telemetry 1.5.0, as pinned; every getProviderEnvValue, ctx.env and computed process.env[...] read swept): AZURE_OPENAI_DEPLOYMENT_NAME_MAP (chooses the deployment); endpoints AZURE_OPENAI_BASE_URL, AZURE_OPENAI_RESOURCE_NAME, OPENROUTER_BASE_URL, KIMI_CODE_OAUTH_HOST, KIMI_OAUTH_HOST.

Generic ACP: no variables of its own; Goose is the bundled ACP harness.

Allowed: credential values (*_API_KEY, *_TOKEN, AWS credential values), account, project and region identifiers on a fixed host (AWS_REGION, GOOGLE_CLOUD_PROJECT/LOCATION, CLOUDFLARE_ACCOUNT_ID/GATEWAY_ID), proxy variables, PI_OAUTH_CALLBACK_HOST (local sign-in listener), and anything else not listed.

Restart agent

Restart agent in an agent's environment-variable settings asks first. It then stops only that agent's processes, in every community and for every membership key including pubkey@host, by awaiting each harness's existing retire(key) under the same idle-only runner custody that a type change uses. Its next message starts them with the saved list. It's refused while the agent is answering or a voice seat is opening or live. It's also refused for protected, hosted and execution-target agents. It's a bundled-only host method; there's no new plugin API. It stays off while the list has unsaved edits ("Save your changes first.").

Windows: one spelling for the Anthropic key

Windows variable names ignore case, so on Windows a save refuses any spelling of ANTHROPIC_API_KEY but the exact one. Claude's sign-in check and the host override then always agree. macOS and Linux are unchanged.

Dev credential helper

just desktop me may read and save the debug-only xyz.block.buzz.desktop.agent-env.agent.debug item for an agent's pubkey (helper protocol 2).

Known limit

Two running copies of the same build can race: one saves while the other deletes the agent's last membership. That can leave a credential item behind. It's the same outcome as two copies editing one agent, or leftover values after a membership is removed.

@wpfleger96
wpfleger96 force-pushed the duncan/per-agent-env branch 5 times, most recently from 6a9d3b4 to e7d643e Compare November 20, 2026 00:17
@wpfleger96
wpfleger96 marked this pull request as ready for review November 20, 2026 00:19
@wpfleger96
wpfleger96 requested a review from a team as a code owner November 20, 2026 00:19

@wesbillman wesbillman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Star Lord’s source review of e7d643e recommends changes to agent launch, credential handling, and lifecycle cleanup. The per-agent feature also needs a core-team decision on whether individual harnesses should register support through a shared native capability. Runtime behavior remains unverified.

Comment thread src/bundled/goose/goose.ts Resolved
Comment thread src-tauri/src/host_process.rs Resolved
Comment thread src/bundled/claude-code/runtime.ts Resolved
Comment thread src/bundled/codex/runtime.ts Resolved
Comment thread src-tauri/src/agent_env.rs Resolved
Comment thread src-tauri/src/agent_env.rs Resolved
Comment thread src-tauri/src/app_agents.rs Resolved
Comment thread src/bundled/agents/AgentEnvironment.tsx Resolved

@kalvinnchau kalvinnchau left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Three additional findings on restart ordering, damaged-list recovery, and API documentation. The cross-instance cleanup race is already covered by discussion_r4636997497.

Comment thread src/bundled/agents/AgentEnvironment.tsx Resolved
Comment thread src-tauri/src/agent_env.rs Resolved
wpfleger96 added a commit that referenced this pull request Nov 20, 2026
Goose asks for the agent list only from a local agent's launch; a saved
per-agent Anthropic key survives Claude's env and counts as a credential;
the custom-header check reads the agent's launch env; a failed dedicated
Codex start is tracked until it exits; harness path variables are
rejected; Save keeps focus; Restart waits for a pending save; the
unreachable damaged-list replace is removed.

Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
Signed-off-by: Will Pfleger <wpfleger@block.xyz>
wpfleger96 added a commit that referenced this pull request Nov 20, 2026
Goose asks for the agent list only from a local agent's launch; a saved
per-agent Anthropic key survives Claude's env and counts as a credential;
the custom-header check reads the agent's launch env; a failed dedicated
Codex start is tracked until it exits; harness path variables are
rejected; Save keeps focus; Restart waits for a pending save; the
unreachable damaged-list replace is removed.

Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
Signed-off-by: Will Pfleger <wpfleger@block.xyz>

@kalvinnchau kalvinnchau left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Two remaining configuration-contract issues are noted inline.

Comment thread src-tauri/src/agent_env.rs Resolved
Comment thread src/bundled/agents/AgentEnvironment.tsx Resolved
wpfleger96 added a commit that referenced this pull request Nov 20, 2026
Goose asks for the agent list only from a local agent's launch; a saved
per-agent Anthropic key survives Claude's env and counts as a credential;
the custom-header check reads the agent's launch env; a failed dedicated
Codex start is tracked until it exits; harness path variables are
rejected; Save keeps focus; Restart waits for a pending save; the
unreachable damaged-list replace is removed.

Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
Signed-off-by: Will Pfleger <wpfleger@block.xyz>
@wpfleger96
wpfleger96 force-pushed the duncan/per-agent-env branch 2 times, most recently from 6ff52cd to 501b5e3 Compare November 20, 2026 18:57

@kalvinnchau kalvinnchau left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 One remaining configuration-root omission; details inline.

Comment thread src-tauri/src/agent_env.rs Resolved
wpfleger96 added a commit that referenced this pull request Nov 20, 2026
Goose asks for the agent list only from a local agent's launch; a saved
per-agent Anthropic key survives Claude's env and counts as a credential;
the custom-header check reads the agent's launch env; a failed dedicated
Codex start is tracked until it exits; harness path variables are
rejected; Save keeps focus; Restart waits for a pending save; the
unreachable damaged-list replace is removed.

Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
Signed-off-by: Will Pfleger <wpfleger@block.xyz>
wpfleger96 added a commit that referenced this pull request Nov 20, 2026
Goose asks for the agent list only from a local agent's launch; a saved
per-agent Anthropic key survives Claude's env and counts as a credential;
the custom-header check reads the agent's launch env; a failed dedicated
Codex start is tracked until it exits; harness path variables are
rejected; Save keeps focus; Restart waits for a pending save; the
unreachable damaged-list replace is removed.

Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
Signed-off-by: Will Pfleger <wpfleger@block.xyz>
wpfleger96 added a commit that referenced this pull request Nov 20, 2026
Goose asks for the agent list only from a local agent's launch; a saved
per-agent Anthropic key survives Claude's env and counts as a credential;
the custom-header check reads the agent's launch env; a failed dedicated
Codex start is tracked until it exits; harness path variables are
rejected; Save keeps focus; Restart waits for a pending save; the
unreachable damaged-list replace is removed.

Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
Signed-off-by: Will Pfleger <wpfleger@block.xyz>
wpfleger96 added a commit that referenced this pull request Nov 20, 2026
@wpfleger96

wpfleger96 commented Nov 20, 2026 •

Copy link
Copy Markdown
Member Author

🤖 Per-agent environment variables — restart controls and browser verification

Rendered from stacked head 859f8501cb2bae340178cb937fd14d97f9eee358 (#3899, containing #4011 84ed4832). Headless Chromium, 2× image density. These replace the earlier-head screenshots.

Evidence boundary: production React UI with fixture-backed native environment-storage responses; not a native desktop build or harness-execution test. The browser app uses a throwaway local relay with separate Postgres, Redis and object storage. Native integration was not attempted: on macOS, the default save path reaches SecKeychain::default(); HOME/app-data separation alone does not select an isolated credential store. No OS Keychain read/write was performed.

Results

  • Check 5 — browser PASS: both restart controls are disabled with unsaved edits; pointer clicks and Enter do not open a confirmation. A deliberately held save also keeps restart disabled; it becomes enabled after save completes.
  • Check 4 — browser-only PASS, native lifecycle UNVERIFIED: confirming Restart agents performs a real document reload. Saved names reappear and the notice clears when the fixture simulates native page-load reset. This does not prove native process retirement or native notice reset.
  • Both confirmation dialogs open, Cancel dismisses them and focus returns to their restart button. The per-agent confirmation dispatches only the selected fixture agent and does not reload the document; real per-agent runtime isolation remains unverified.
  • Checks 1, 2 and 6 — NOT RUN natively: no evidence here that actual Claude/Codex/Goose/Pi processes receive the lists, that a second running agent keeps its old environment, or that read-protected excludes them.
  • Check 3 — NOT RUN live: no native Huddle was available in this browser-only sandbox. These screenshots add no Huddle evidence.

No product defect was observed in the exercised browser interactions. This is partial verification, not a full-stack shipping verdict.

Saved list and enabled restart — light

Per-agent saved list and enabled restart, light

Saved list and enabled restart — dark

Per-agent saved list and enabled restart, dark

Restart confirmation — light

Per-agent restart confirmation, light

Restart confirmation — dark

Per-agent restart confirmation, dark

Unsaved edit disables restart — light

Per-agent unsaved edit disables restart, light

Unsaved edit disables restart — dark

Per-agent unsaved edit disables restart, dark

@wpfleger96
wpfleger96 force-pushed the duncan/per-agent-env branch 2 times, most recently from 3b5d5ed to dd01e0b Compare November 20, 2026 20:45
wpfleger96 added a commit that referenced this pull request Nov 20, 2026

@jedwards27 jedwards27 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 :bot: Jude’s code review agent — COMMENT (recommend request changes)

Reviewed: 877a7e905842df1037764f5a0a7ebad1b49f35e0..5dea3b7b78adb501469c99826817119cfb04433a (exact head 5dea3b7b78adb501469c99826817119cfb04433a). Risk: critical — native credential custody and agent process environments. Traced Settings → Tauri commands → credential store → host process, four bundled harnesses, last-community deletion and sign-out. This changes no observed relay-wire contract.

Blocking findings / author action:

  1. P2 — case-variant Anthropic key breaks the documented per-agent credential precedence on Windows. src-tauri/src/agent_env.rs:309-340 accepts anthropic_api_key, but src/bundled/claude-code/auth.tsx:310-319,359-362 only recognizes ANTHROPIC_API_KEY and src-tauri/src/host_process.rs:582-587,695-710 only reapplies that exact spelling. With no shared key, signed-out Claude refuses launch; with a shared key, the shared key can win instead of the agent’s chosen key. Windows environment names are case-insensitive, but these preflight/override comparisons are not. Canonicalize the special credential at save or recognize all variants consistently at both seams; add regression coverage for signed-out launch and shared-key precedence.
  2. P2 — concurrent app copies can leave a credential behind after deleting the last membership. AgentEnvs::set checks registry eligibility and awaits a write under an instance-local mutex (src-tauri/src/agent_env.rs:470-495); another copy can delete the list before removing the agent row (src-tauri/src/app_agents.rs:299-328). If copy B passes eligibility, copy A deletes, then B writes, the deleted agent’s OS credential item is recreated and will not be retried by deletion. The existing review discussion acknowledged stale cross-copy state, but this ordering defeats the PR’s cleanup contract, not just Settings freshness. Coordinate eligibility, save and last-membership deletion across app copies; cover the interleaving.
  3. P2 — Restart Buzz silently discards newer environment edits. Once a list was saved, src/bundled/agents/AgentEnvironment.tsx:173-205 enables Restart when dirty is true (only pending disables it), then calls native update_restart directly. The useAgentSaveState guard at lines 30-31 covers leaving a tab/agent, not this relaunch. Reproduce by editing a saved variable, choosing Restart Buzz, and confirming: the edit is lost with no discard warning. Disable restart until saved with explanatory copy, or ask explicitly to discard the draft; cover saved-list → dirty edit → restart in a behavior test.

Verification owner: author for fixes and affected tests, including a Windows child-environment check; reviewer/tooling for isolated macOS/native journey and full-package follow-up; CI/release gate for pending exact-head checks. Validation: on a clean checkout at the exact head above, git diff --check 877a7e905842df1037764f5a0a7ebad1b49f35e0..HEAD passed. Source/contract review and existing test assertions only; no new package suite, isolated native journey or Windows runtime execution was run. At review time GitHub checks were 46 passed, 28 pending and 1 skipped; pending is not a defect by itself. Residual risk: real OS credential-store and cross-process ordering, Windows child-env and native restart UI remain unobserved at the reviewed artifact. Fixes or a new head require fresh review.

request changes

wpfleger96 added a commit that referenced this pull request Nov 21, 2026
Goose asks for the agent list only from a local agent's launch; a saved
per-agent Anthropic key survives Claude's env and counts as a credential;
the custom-header check reads the agent's launch env; a failed dedicated
Codex start is tracked until it exits; harness path variables are
rejected; Save keeps focus; Restart waits for a pending save; the
unreachable damaged-list replace is removed.

Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
Signed-off-by: Will Pfleger <wpfleger@block.xyz>

@jedwards27 jedwards27 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 :bot: Jude’s code review agent — COMMENT (recommend request changes)

Reviewed: 9763561d55259ea6ed39998de3aad7f521bd3b31..d78b93ed8299d66f0e95ab9eb1fb60d02873a66f (exact head d78b93ed8299d66f0e95ab9eb1fb60d02873a66f). Risk: critical — OS-stored secrets, agent child environments, deletion and restart. Traced Settings → Tauri credential store → per-agent host process and the four bundled harnesses; no relay-wire contract change found in the PR paths reviewed.

Fixed since the previous review: Windows now refuses noncanonical casing of ANTHROPIC_API_KEY (src-tauri/src/agent_env.rs:273,309–327; test at agent_env_tests.rs:439–447). Restart is now per-agent, disabled for a dirty draft (src/bundled/agents/AgentEnvironment.tsx:179–224; test at AgentEnvironment.test.tsx:300–310). These source/test changes do not constitute Windows or native runtime proof.

Remaining author-actionable findings:

  1. P2 — a concurrent app copy can recreate a deleted agent’s secret. AgentEnvs::set checks registry eligibility and awaits the credential write under an instance-local mutex (src-tauri/src/agent_env.rs:427–445,475–501). Another copy can finish last-membership credential deletion (src-tauri/src/app_agents.rs:299–333) after that check but before the first copy’s store replace. The OS-store lock serializes each operation, not this eligibility→delete→write lifecycle; the orphaned item can be consumed if the pubkey is imported again. This is a deletion-contract failure, not just stale Settings state. Author action: serialize eligibility/save/last-membership cleanup across copies (or otherwise fence writes after deletion), and regression-test that ordering. The PR documents this as a known limit, but documentation does not prevent secret restoration.
  2. P2 — an item in the other build’s namespace survives deletion and can be used after reimport. Debug/release use separate credential services (src-tauri/src/agent_env.rs:21–27), but share the agent registry (src-tauri/src/lib.rs:1169–1203). Last-membership deletion only clears the current build’s item (src-tauri/src/agent_env.rs:490–525); if the same pubkey is imported again in the other build, eligible_here/for_spawn reads its old credential (:528–569). The prior response says the other build’s values are never used, which omits reimport. Author action: align cleanup/ownership with the shared registry or prevent old-item reuse; cover delete in one build → reimport in the other, in both directions.
  3. P2 — editing during Restart agent can make the promised saved list miss the next process. AgentEnvironment.tsx:105–169 gates list inputs/Add/Remove on pending and Save on dirty, but not on restarting; only the Restart button is blocked at :191. Confirming sets restarting at :212–224, while src/features/agents/runner.ts:1295–1307 releases the transition and drains queued turns as soon as the restart callback settles. A user can edit and start a save during the pending restart; a resumed process may launch before the new save applies despite the restart affordance. Author action: lock edits and Save until restart settles (or serialize the operations), with a deferred-restart behavior test proving recovery afterward.

Verification owner: author for code fixes and the targeted cross-copy, cross-build and deferred-restart regressions; reviewer/tooling for an isolated macOS native Settings→child-process journey; author/Windows validation for child-env credential precedence. Validation: source and test inspection on Jude’s Mac at clean d78b93e; git diff --check 9763561d55259ea6ed39998de3aad7f521bd3b31 HEAD passed with matching git rev-parse HEAD. Hosted checks at review time: 69 SUCCESS, 1 SKIPPED (Windows native validation); these are not substitutes for the missing native journeys. No new full local package suite, Windows child process, Keychain fault-injection or UI/native restart journey run. Residual risk: cross-process ordering and native credential behavior have not been independently exercised; re-review fixes at their new exact head.

request changes

@jedwards27 jedwards27 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 :bot: Jude’s code review agent — COMMENT (recommend request changes)

Reviewed: 9763561d55259ea6ed39998de3aad7f521bd3b31..08a62a010777fec885d7b5b0610417241a3e427c (exact head 08a62a010777fec885d7b5b0610417241a3e427c). Risk: critical — OS-stored secrets, agent child environments and deletion. Traced Settings → native credential store → child-process admission and restart; the changed commits do not alter a relay message/auth contract.

Fixed since the prior review: The editor now locks name/value/Add/Remove during restart and keeps Save inactive (src/bundled/agents/AgentEnvironment.tsx:74–76,112–170,190–225); AgentEnvironment.test.tsx:129–164 holds a restart, asserts the locked state, and checks editing after release. The latest commit moves release into finally, avoiding a stuck test if an assertion fails. This is source/test evidence, not native runtime proof.

Remaining author-actionable findings:

  1. P2 — concurrent app copies can recreate a deleted agent’s secret. AgentEnvs::set checks eligibility and then writes under an instance-local lock (src-tauri/src/agent_env.rs:427–445,475–501). A second copy can complete last-membership deletion (src-tauri/src/app_agents.rs:299–333) between that check and the write; the per-operation OS-store lock does not fence the whole lifecycle. A later reimport of the pubkey can consume the orphaned item. Author action: fence eligibility/save against cross-copy last-membership cleanup, with a deterministic two-copy interleaving regression. Documenting the race as a known limit does not preserve the stated cleanup contract.

  2. P2 — deletion in one build leaves a reusable secret in the other build. Debug/release select different credential service names (src-tauri/src/agent_env.rs:21–27) while sharing the agent registry (src-tauri/src/lib.rs:1169–1203). Last-membership delete clears only this build’s item (src-tauri/src/agent_env.rs:490–525); reimporting the same pubkey in the other build makes its old item eligible for for_spawn (:528–569). Author action: align cleanup/ownership across namespaces or prevent old-item reuse, and cover delete → reimport in both build directions.

  3. P2 — a failed restart can vanish when Settings is left during the operation. AgentEnvironment.tsx:38 reports only dirty/save state to the tab guard; the restart and error state remain component-local (:30–33,213–225). AgentTabs.tsx:102–110,170–201 permits switching tabs while restart is pending and unmounts Settings. A subsequent rejection writes its error into the unmounted editor; returning to Settings shows no failure. A shutdown failure can leave the old process entry in place (src/bundled/goose/runtime.ts:411–437), so the user may believe the saved variables have applied when they have not. Author action: preserve restart outcome across tab navigation (or hold the tab until it settles), with a deferred reject → switch → return regression showing failure and retry.

Verification owner: author for all three code fixes and targeted regressions; reviewer/tooling for isolated macOS native Settings→restart→child-process evidence and full applicable package validation. Validation: read-only source/diff inspection on Jude’s Mac, git diff --check 9763561d55259ea6ed39998de3aad7f521bd3b31 08a62a010777fec885d7b5b0610417241a3e427c passed. No package suite, actual Keychain/Windows child-process run or native UI journey claimed. Hosted exact-head checks were pending at inspection; they are not proof of native custody. Residual risk: cross-copy ordering and two-build cleanup remain unverified in native execution as well as defective in source. Re-review any fix at its new exact head.

request changes

@jedwards27 jedwards27 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 :bot: Jude’s code review agent — COMMENT (recommend request changes)

Reviewed: 9763561d55259ea6ed39998de3aad7f521bd3b31..4cb2fa0cee769a94da0b8226ba1f05ea6e6587f3 (exact head 4cb2fa0cee769a94da0b8226ba1f05ea6e6587f3). Risk: critical — local OS-stored secrets, agent process environments, identity deletion/reimport and restart. Traced Settings → native credential store → child-process admission, last-membership cleanup and tab/navigation state. No relay-wire contract change identified in the changed paths.

Fixed in this head: src/bundled/agents/AgentEnvironment.tsx:39 now reports restart as pending to the shared save-state guard. AgentTabs.tsx:102–110,157–166 holds other tabs until restart settles, preserving a rejected restart’s error and retry affordance. The deferred-rejection regression in AgentEnvironment.test.tsx:337–371 fails when the new restarting guard is removed. No further author action on this UI fix.

Remaining author-actionable findings:

  1. P2 — a second app copy can recreate a deleted agent secret. AgentEnvs::set checks eligibility and then writes under a process-local turn (src-tauri/src/agent_env.rs:427–445,475–501), while last-membership removal in another copy deletes the credential before its row (src-tauri/src/app_agents.rs:299–333). Copy A can pass eligibility, copy B can delete the last membership and credential, then A can replace the item. A later import of that pubkey can consume the supposedly deleted values. The existing same-instance delete/save test does not interleave two copies. Author action: fence eligibility→write against cross-copy last-membership deletion (or otherwise prevent post-delete writes), with a deterministic two-copy interleaving regression.
  2. P2 — deletion in one build leaves the other build’s stale secret reusable after reimport. Debug and release select distinct credential service names (src-tauri/src/agent_env.rs:21–27), but the development build shares the installed app’s agent registry (src-tauri/src/lib.rs:1169–1203). forget deletes only the running build’s item (agent_env.rs:490–525); reimport of the same pubkey in the other build makes its old item eligible for for_spawn (:528–569). A value expected to be removed may silently reach an agent process. Author action: align namespace cleanup/ownership or invalidate old items on reimport, and cover delete→reimport in both build directions.

Verification owner: author for those fixes, interleaving/two-build regressions and isolated credential-store verification; reviewer/tooling for an independent native macOS Settings→restart→child-process journey; CI/release owners for pending checks and skipped Windows native validation. Missing native observation is a confidence gap, not a third defect.

Validation: focused bin/pnpm exec vitest run src/bundled/agents/AgentEnvironment.test.tsx passed 13/13 on the clean exact head; removing the new restarting signal made its tab-disabled assertion fail, and the original was restored. Full base→head git diff --check passed. At preflight GitHub reported 52 success, 16 in progress and 1 skipped (Windows native validation). No full package suite, real Keychain/multi-copy/two-build run, Windows child environment or native UI journey is claimed. The focused DOM test and temporary keyboard probe are not native proof.

Residual risk: credential lifecycle and restart behavior remain unwitnessed at the native boundary; the two source-level deletion defects above still require author changes. A new head requires a fresh review.

request changes

wpfleger96 and others added 15 commits November 20, 2026 23:16
Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
Signed-off-by: Will Pfleger <wpfleger@block.xyz>
Goose asks for the agent list only from a local agent's launch; a saved
per-agent Anthropic key survives Claude's env and counts as a credential;
the custom-header check reads the agent's launch env; a failed dedicated
Codex start is tracked until it exits; harness path variables are
rejected; Save keeps focus; Restart waits for a pending save; the
unreachable damaged-list replace is removed.

Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
Signed-off-by: Will Pfleger <wpfleger@block.xyz>
Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
Co-authored-by: wpfleger <wpfleger@block.xyz>
Signed-off-by: wpfleger <wpfleger@block.xyz>
Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
…iables

The dev credential helper served no agent-env item, so under `just desktop me` each agent's list could be neither read nor saved. Serve the debug per-agent item by pubkey, and bump the protocol so a helper that serves it is installed.

Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
Replace the per-agent Restart Buzz notice with a stable Restart agent action. After a confirmation it calls a bundled-only restartAgent, which holds every membership of the agent as a change of type does, so no turn starts meanwhile, and retires each with its type's own retire. It's refused while the agent answers or has a voice seat opening or live, and for protected, hosted and execution-target agents.

Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
…e case

On Windows anthropic_api_key is ANTHROPIC_API_KEY, but Claude's sign-in check and the host override match only the exact spelling, so a signed-out Claude refused to start or the shared key won. Refuse other spellings there at save; elsewhere they stay other variables.

Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
A restart would drop them; it says to save first.

Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
Restart agent refused only once a seat reached the voice wrapper, after
the Huddle had already awaited its bridge, so a restart could retire an
agent whose seat was opening. The Huddle now reserves the seat first, and
a seat can't be reserved while the agent restarts.

Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
Holds the owner's bridge opening pending: a restart is refused and
retires nothing until the seat ends, and a seat started during a restart
opens no bridge and says why.

Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
Signed-off-by: Will Pfleger <wpfleger@block.xyz>
Signed-off-by: Will Pfleger <wpfleger@block.xyz>
Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
Signed-off-by: Will Pfleger <wpfleger@block.xyz>
Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
@wpfleger96

Copy link
Copy Markdown
Member Author

🤖 Addressed in df96d5e2, 3caf6520 and d0481d77. Both PRs are rebased onto main 5d7e3343, and CI passed on both heads.

  • Editing while Restart agent runs: the env list's name and value inputs, Add and Remove are locked while a save or restart runs (df96d5e2). The held-restart test always releases the restart, even if an assertion fails (3caf6520).
  • A failed restart lost on tab switch: a running restart now holds the agent's tabs, and leaving the agent, the same way a save does. A failed restart's error and its retry stay on screen (d0481d77). The new test holds a restart, tries to switch tabs, rejects the restart and checks the error shows.
  • Findings 1 and 2 (a second running copy writing a deleted agent's list back, and the other build's leftover list being read after the same agent key is re-imported): a complete fix needs a design change, tying each saved list to the specific time the agent was added to the device and handling cached copies. That decision is pending. We'll reply here once it's made.

@jedwards27 jedwards27 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 :bot: Jude’s code review agent — COMMENT (recommend request changes)

Reviewed: 5d7e3343543911bbce3e565cb70555a9f3bfffb5...d0481d77738ca19166340fefb09cd00f19f0c89c (exact head d0481d77738ca19166340fefb09cd00f19f0c89c). Risk: critical — OS-stored agent secrets, process admission, deletion, restart and recovery. Reviewed the PR three-dot delta and traced native credential/registry ownership and Settings → agent-panel navigation; no changed relay wire contract identified. Both systems and UI/product review lanes are included.

Author-actionable findings:

  1. P2 — cross-copy stale secrets and post-delete resurrection. src-tauri/src/agent_env.rs:222–237,270–305,431–503 caches a credential for the life of each copy and serializes save/delete only within that copy; the credential-store lock covers individual writes, not the eligibility→write transaction (crates/credential-store/src/lib.rs:399–417). One copy can continue spawning an old value or overwrite another copy’s save. A save that passed eligibility before another copy starts last-membership deletion can write after the credential and registry row are removed (src-tauri/src/app_agents.rs:308–333); reimporting the pubkey can inherit the orphaned secret. Author action: coordinate cross-process per-agent read/eligibility/write with final deletion (or equivalent revision fencing), invalidate stale cache, and add gated two-copy save→spawn/save and eligibility→delete→write/reimport regressions. This is a lifecycle defect, not a demand for a native reviewer artifact.
  2. P2 — debug/release namespaces do not share deletion ownership. src-tauri/src/agent_env.rs:21–27,490–525 selects separate credential service names but src-tauri/src/lib.rs:1191–1203 shares the agent registry. Deleting the last membership in one build removes only its own credential, leaving the other build’s old item; reimporting the same pubkey there makes that value eligible for spawn (agent_env.rs:548–569). The cross-copy serialization remedy above must also handle these independently named items. Author action: align cleanup/ownership across builds or invalidate old items on reimport, and cover delete→reimport in both build directions.
  3. P2 — routed navigation can discard the only Save/Restart failure recovery. src/bundled/agents/AgentsPage.tsx:513–520 directly sets the routed agent, bypassing browse’s busy/dirty guard (:352–360). During an environment save or restart, navigating to another agent unmounts the keyed details (:746–763); the rejected operation then records its error only in the unmounted component (AgentEnvironment.tsx:82–98,214–226). The new tab-switch test (AgentEnvironment.test.tsx:340–372) does not exercise this route. Author action: fence routed selection while the first agent is busy, or retain per-agent operation/error state, and add a held-operation routed-navigation regression with rejection and visible retry/draft recovery.

Verification owner: author for the three fixes and deterministic regressions; reviewer/tooling for independent native macOS Settings→save→restart→child-process and two-copy checks; CI/release gate for Windows native validation. Validation: on the Mac, exact target object git rev-parse d0481d7 matched the full head and git diff --check 5d7e334...d0481d7 passed; source/test review only, not a checked-out native run. Both review lanes independently checked the same exact head; at final preflight GitHub showed 69 successful checks and one skipped Windows native validation. No full package suite or credential-store/native UI run is claimed. Residual risk: additional platform-specific credential and process behavior remains unobserved; skipped Windows verification is a confidence gap, not an additional author defect.

request changes

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants